Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
SLAM Map Building with TurtleBot
Description: How to generate a map using gmappingTutorial Level: BEGINNER
Next Tutorial: Autonomous Navigation of a Known Map with TurtleBot
Contents
This assumes that you have a TurtleBot which has already been brought up in the turtlebot bringup tutorials. The default navigation parameters provided on turtlebot_navigation should be apropriate in most cases, but if not, take a look at the setup navigation tutorial.
If you are using a Create base, then performance will be greatly enhanced by accurate calibration, refer to the TurtleBot Odometry and Gyro Calibration tutorial. Note that the Kobuki has a factory calibrated gyro inside and shouldn't need extra calibration.
Launch the gmapping app
On the TurtleBot
- Bring up the robot
roslaunch turtlebot_bringup minimal.launch
- Run the gmapping demo app
roslaunch turtlebot_navigation gmapping_demo.launch
On your Workstation
This assumes you have ROS on your workstation and ROS_MASTER_URI has been set to point to your turtlebot. Please read Workstation Installation and Network configuration before this.
- Launch rviz:
# Pre-Groovy rosrun rviz rviz -d `rospack find turtlebot_navigation`/nav_rviz.vcg # Groovy or later roslaunch turtlebot_rviz_launchers view_navigation.launch
On the TurtleBot
Drive the robot around by either:
Using telop (keyboard, joystick, or other) from Teleoperation Tutorials
If you are having troubles making a map check out this question.
- Save the map to file:
rosrun map_server map_saver -f /tmp/my_map
Note: Do not close the gmapping launch until saving the map.
Video of process
In rviz it will look something like this:
To see the map updates on RViz as you drive the robot around, under Map on the left hand side panel, check to see that Topic is set to map, in addition to setting your ROS_MASTER_URI to the Turtlebot.